﻿// -----------------------------------------------------------------------
// <copyright file="Crypto.cs" company="Microsoft">
// TODO: Update copyright text.
// </copyright>
// -----------------------------------------------------------------------

namespace AwesomeUtils
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using BlowfishNET;
    using System.Web.Security;

    /// <summary>
    /// TODO: Update summary.
    /// </summary>
    public class Crypto
    {

        public static string OneWayHash(string text)
        {
            return FormsAuthentication.HashPasswordForStoringInConfigFile(text, "sha1");
        }


        public static string BlowfishEncrypt(string PlainText, string Key)
        {
            BlowfishNET.BlowfishSimple bs = new BlowfishNET.BlowfishSimple(Key);
            return bs.Encrypt(PlainText);
        }
        public static string BlowfishDecrypt(string cipherText, string Key)
        {
            BlowfishNET.BlowfishSimple bs = new BlowfishNET.BlowfishSimple(Key);
            return bs.Decrypt(cipherText);
        }
    }
}
